package com.yzy.demo.test.service.impl;

import com.yzy.demo.common.test.TestClient;
import com.yzy.demo.test.service.YzyService;
import com.yzy.demo.test.vo.ResponseBo;
import com.yzy.demo.test.vo.TestQuert;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yangzhenyu
 * */
@Service
public class YzyServiceImpl implements YzyService {
    /**微服务调用测试*/
    @Autowired
    private TestClient client;
    /**
     * 微服务调用测试
     * */
    public ResponseBo weifuw(TestQuert vo) {
        if (StringUtils.isEmpty(vo.getId())){
            return ResponseBo.error("id 不能为空");
        }
        String test = client.test(vo.getId());
        if(null == test){
            return ResponseBo.error("微服务调用失败");
        }
        return ResponseBo.ok(test);    }
}
